<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>

<script type="text/javascript">
	function loginLogMenuTree_onNodeClick2(event, treeId, treeNode) {

		if (treeNode.id == '1') {
			$("#loginSuccess").val("0")
		} else {

			$("#loginSuccess").val("1")
		}
		loginLogMenuTree_onNodeClick(event, treeId, treeNode);
	}

	function formatterUsername(cellvalue) {
		return "<a href='javascript:void(0)' onclick='isperp.openDialog({contentUrl:\"app/user/view?name="+cellvalue+"\"});'>" + cellvalue + "</a>";
	}
</script>
<isperp:grid url="app/loginLog/list" gridId="loginLogGrid"
	datatype="local" gridTitle="${pageTitle}" cusFormatterActions="true"
	cusDeleteUrl="app/loginLog/delete" sortname="created_date"
	sortorder="desc" afterGridCreate="loginLogMenuTree_onNodeClickFirst();">
	<jsp:attribute name="searchbar">
	<input type="hidden" value="0" id="loginSuccess" field="success"
			op="eq">
	</jsp:attribute>
	<jsp:attribute name="toolbar">
	<isperp:treeMenu id="loginLogMenu" targetGridId="loginLogGrid"
			nodes="[{id:1,name:'登录失败'},{id:2,name:'登录成功'}]">
		<isperp:async enable="false"></isperp:async>
		<isperp:data simpleData="true"></isperp:data>
		<isperp:callback onClick="loginLogMenuTree_onNodeClick2">
		</isperp:callback>
	</isperp:treeMenu>
	<isperp:button icon="icon-plus" text="清空所有"
			onclick="isperp.confirmAlert('您确定要清空所有登录日志？',{yes:function(){$.post('app/loginLog/deleteAll')}})"></isperp:button>
	</jsp:attribute>

	<jsp:body>
	<isperp:column name="id" title="id" hidden="true"></isperp:column>
	<isperp:column name="username" title="登录帐号" width="50"
			isFormatterFun="true"
			formatter="return formatterUsername(cellvalue);">
	</isperp:column>
	<isperp:column name="ip" title="IP" width="80">
	</isperp:column>
	<isperp:column name="success" title="是否成功" formatter="checkbox"
			width="50">
	</isperp:column>
	<isperp:column name="createdDate" title="发生日期" width="100"
			sortable="true">
	 </isperp:column>
	<isperp:column name="info" title="信息" width="200">
	</isperp:column>
	</jsp:body>
</isperp:grid>

